<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <title>货品列表</title>
    <link rel="stylesheet" type="text/css" href="http://127.0.0.1/mogujie/Static/hdjs/hdjs.css"/>
    <script src="http://127.0.0.1/mogujie/Static/js/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="http://127.0.0.1/mogujie/Static/hdjs/hdjs.min.js" type="text/javascript" charset="utf-8"></script>
   
</head>
<body>
<div class="wrap">
    <table class="table2 hd-table hd-table-list">
        <thead>
        <tr>
            <td width="100">货品id</td>
            <?php foreach($addData as $v): ?>
            		<td><?php echo $v['name'] ?></td>
            <?php endforeach ?>
            <td width="100">货号</td>
            <td width="100">库存</td>
            <td width="50">操作</td>
            
        </tr>
        </thead>
        <tbody>
        		<?php foreach($showData as $v): ?>
		        <tr>
		            <td width="100"><?php echo $v['glid'] ?></td>
		             <?php foreach($v['value'] as $value): ?>
		             		<td><?php echo $value['gtvalue'] ?></td>
		              <?php endforeach ?>
		            <td width="100"><?php echo $v['number'] ?></td>
		            <td width="100"><?php echo $v['inventory'] ?></td>
		            <td width="200">
						<a href="<?php echo U('edit',array('gid'=>$_GET['gid'],'glid'=>$v['glid']));?>" class="hd-btn hd-btn-success hd-btn-xm">编辑</a>
						<a href="javascript:del_modal(<?php echo $v['glid'];?>);" class="hd-btn hd-btn-danger hd-btn-xm">删除</a>
		            </td>
	        	</tr>
	        	<?php endforeach ?>
	        	<form action="" method="post">
		    		<tr>
	        			
	        			<td>添加货品</td>
		        			<?php foreach($addData as $v): ?>
		        				<td>
		        					<select name="spec[]">
		        						<option value="0">请选择</option>
		        						<?php foreach($v['value'] as $value): ?>
		        						<option value="<?php echo $value['gtid'];?>"><?php echo $value['gtvalue'];?></option>
		        						<?php endforeach ?>
		        					</select>
		        				</td>
		        			<?php endforeach ?>
	        			<td>
	        				<input type="text" name="number" id="" />
	        			</td>
	        			<td>
	        				<input type="text" name="inventory" id="" />
	        			</td>
	        			<input type="hidden" name="gid" value="<?php echo $hd['get']['gid'];?>" />

	        			<td>
	        				<input type="submit" value="添加" class="hd-btn hd-btn-primary hd-btn-xm"/>
	        				
	        			</td>
	        		</tr>
	        			
	        	</form>
        		
        </tbody>
        
    </table>
    
    <!--<style type="text/css">
    		.page_hdcms{
    			margin-top: 20px;
    			text-align: center;
    		}
    		.page_hdcms a{
    			padding: 3px 5px;
    			margin-left: 3px;
    			border: 1px solid #CCCCCC;
    			
    		}
    		.page_hdcms strong{
    			padding: 3px 5px;
    			margin-left: 3px;
    			background: red;
    			color: white;
    		}
    </style>
    <div class="page_hdcms">
        <?php echo $page;?>
    </div>-->
</div>

</body>
<script type="text/javascript">
	function del_modal(glid){
		hd_modal({
            width: 400,//宽度
            height: 220,//高度
            title: '确认删除吗？',//标题
            content: '',//提示信息
            button: true,//显示按钮
            button_success: "确定",//确定按钮文字
            button_cancel: "取消",//关闭按钮文字
            timeout: 0,//自动关闭时间 0：不自动关闭
            shade: true,//背景遮罩
            shadeOpacity: 0.3,//背景透明度
            success: function () {//点击确定后的事件
				location.href='<?php echo U("del");?>' + '&glid=' + glid;
            },
            cancel: function () {//点击关闭后的事件

            }
        });
	}
</script>
</html>


